package fr.upmc.ta.android;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class VCircle extends View {
	
	private ArrayList<Point> points;
	private Paint paint;
	
	public VCircle(Context context) {
		super(context);
		paint = new Paint();
		
		points = new ArrayList<Point>();
		createCircle();
	}
	
	public void addPoint(Point p) {
		points.add(p);		
	}
	public void draw(Canvas canvas) {
		for(Point p : points) {
			paint.setColor(p.getCouleur());
			canvas.drawCircle((float)p.getX(), (float)p.getY(), 15, paint);
		}
		invalidate();
		super.draw(canvas);
	}
	
	private void createCircle() {
		points.add(new Point(14,14,Color.RED));
		points.add(new Point(65, 20, Color.GREEN));
		points.add(new Point(100, 10, Color.BLACK));
		points.add(new Point(45, 50, Color.BLUE));
		points.add(new Point(20, 70, Color.CYAN));
	}

}
